<template>
	<view>
		<cu-custom bgColor="bg-gradual-green" :isBack="true">
			<block slot="backText"></block>
			<block slot="content">我的关注</block>
		</cu-custom>

		<view class="cu-card dynamic">
			<view class="cu-item shadow" v-for="(item,index) in list" :key="index">
				<view class="cu-list menu-avatar">
					<view class="cu-item">
						<view @click="toNav('/pages/info/index?user_id='+item.id)" class="cu-avatar round lg" :style="{'background-image':'url('+ item.avatar +')'}"></view>
						<view class="content flex-sub">
							<view>{{ item.nickname }}</view>
							<!-- <view class="text-gray text-sm flex justify-between">
								粉丝数量：29
							</view> -->
						</view>
						<view class="action text-red text-bold" style="position: relative;" @click="onFocus(item.id)">
							取关
						</view>
					</view>
				</view>
			</view>
			
		</view>

	</view>
</template>

<script>

	export default {
		data() {
			return {
                list:[]
            }
		},
		onShow() {
            this.getFocusList();
			console.log("success")
		},
		onHide() {
			console.log("hehe")
		},
		onLoad() {
			console.log("haha")
		},
		methods: {
            getFocusList(){
                uni.showLoading({
                    title:'加载中...'
                })
                this.$http.post('getFocusList',{
                    limit:1000
                }).then(res=>{
                    this.list = res.data.data;
                    uni.hideLoading()
                    console.log(res)
                }).catch(err=>{
                    uni.hideLoading()
                    console.log(err)
                })
            },
            onFocus(id) {
                console.log(id,111)
                let form = {
                    type: 1,
                    target_id: id
                }
            
                this.$http.post('focus', form).then(res => {
                    this.getFocusList();
                })
            },
			toNav(link) {
				uni.navigateTo({
					url: link
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	
</style>
